/*
 * @Description: 
 * @Author: chenjiaxin
 * @Date: 2021-12-20 21:32:20
 * @LastEditTime: 2022-01-04 20:54:31
 * @FilePath: \novel-serve\src\router\user.router.js
 */
const Router = require("koa-router");

const { verifyUser, handlePassword } = require("../middleware/user.middleware");
const { createUser, getEmailCode } = require("../controller/user.controller");
const { paramCheckBody, paramCheckQuery } = require("../middleware/check.middleware");
// const { getCode } = require("../utils/email");

const userRouter = new Router({prefix: "/user"});

userRouter.post("/register", paramCheckBody(false, "e_mail", "password"), verifyUser, handlePassword, createUser);

userRouter.get("/getCode", paramCheckQuery(false, "e_mail"), getEmailCode);

module.exports = userRouter;
